package server.mobiles;

import java.util.Collection;
import java.util.Random;
import java.util.TimerTask;

import server.utility.Point2d;



public class MobMoves extends TimerTask {
	private Collection<Mobile> mobiles;
	private Random rand = new Random();
	public MobMoves(Collection<Mobile> collection){
		mobiles=collection;
	}
	
	@Override
	public void run() {
		for(Mobile mob:mobiles){
			if(mob.isPlayer())
				continue;
			
			mob.move(new Point2d(rand.nextInt(10)-5, rand.nextInt(10)-5));
			mob.changeHealth(-10);
		}
	}

}
